﻿using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;

namespace SZ.Mech
{/// <summary>
/// 太阳耀斑忽略
/// </summary>
    public class CompProperties_ElectricityDisabledIgnore : CompProperties
    {
        public CompProperties_ElectricityDisabledIgnore()
        {
            compClass = typeof(CompElectricityDisabledIgnore);
        }
    }

    public class CompElectricityDisabledIgnore : ThingComp
    {
        public CompProperties_ElectricityDisabledIgnore Properties
        {
            get
            {
                return (CompProperties_ElectricityDisabledIgnore)props;
            }
        }

        public override void CompTick()
        {
            base.CompTick();
            SolarFlareTick(1);
        }
        private void SolarFlareTick(int tickAmount)
        {
             

            if (Find.World.GameConditionManager.ElectricityDisabled(this.parent.Map))
            {
                Building build = (this.parent as Building);
                CompPowerTrader compPowerTrader = build.TryGetComp<CompPowerTrader>();
                compPowerTrader.PowerOn = false;
            }
        }
    }
}
